package com.yanjin.test;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Toast;

import com.yanjin.test.presenter.TestLoaderPresenter;
import com.yanjin.test.view.TestLoaderMessage;

public class Main2Activity extends BaseActivity<TestLoaderMessage,TestLoaderPresenter<TestLoaderMessage>> implements TestLoaderMessage{

    private TestLoaderPresenter mTestPresenter;
    private final String TAG="Main2Activity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);
    }

    @Override
    public TestLoaderPresenter<TestLoaderMessage> createPrensenter() {
        return new TestLoaderPresenter<TestLoaderMessage>(this);
    }

    public void mvpTest(View view){
        mTestPresenter = new TestLoaderPresenter(this);
        mTestPresenter.getMessageToPresenter();
    }

    @Override
    public void onLoaderStart() {
        Log.e(TAG,"onLoaderStart");
    }

    @Override
    public void onFail() {
        Log.e(TAG,"onFail");
    }

    @Override
    public void onSuccess(String value) {
        Toast.makeText(this, value, Toast.LENGTH_SHORT).show();
    }
}
